#!/bin/sh
#
# $OpenBSD: rabbitmq.rc,v 1.5 2012/08/04 15:28:14 ajacoutot Exp $

daemon="${TRUEPREFIX}/sbin/rabbitmq-server -detached"
daemon_user="_rabbitmq"

. /etc/rc.d/rc.subr

rc_reload=NO
rc_usercheck=NO

rc_pre() {
	install -d -o ${daemon_user} /var/run/rabbitmq
}

rc_check() {
	# return 1 is needed: rabbitmqctl returns a higher error code on failure
	${TRUEPREFIX}/sbin/rabbitmqctl status || return 1
}

rc_stop() {
	${TRUEPREFIX}/sbin/rabbitmqctl stop
}

rc_cmd $1
